# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=amavis
pkgver=2.12.2
pkgrel=1
pkgdesc="High-performance interface between mailer (MTA) and content checkers"
url="https://gitlab.com/amavis/amavis"
arch="noarch !x86" # perl-db
license="GPL-2.0-or-later BSD-2-Clause-Views"
provides="amavisd-new=$pkgver-r$pkgrel"
depends="sed file perl perl-archive-zip perl-carp perl-convert-tnef
	perl-compress-raw-zlib perl-convert-uulib perl-digest-md5 perl-io
	perl-exporter perl-io-stringy perl-mime-tools
	perl-mailtools perl-socket perl-net-libidn perl-net-server
	perl-time-hires perl-unix-syslog perl-mail-dkim
	perl-io-socket-inet6 perl-io-socket-ssl
	perl-mail-spamassassin
	"
makedepends=""
install="$pkgname.pre-install"
options="!check"
subpackages="$pkgname-openrc"
source="https://gitlab.com/amavis/amavis/-/archive/v$pkgver/amavis-v$pkgver.tar.gz
	amavisd.initd
	amavisd.confd
	amavisd-conf.patch
	"
pkgusers="amavis"
pkggroups="amavis"
builddir="$srcdir"/$pkgname-v$pkgver

package() {
	_amavis_home=/var/amavis

	for dir in $_amavis_home/tmp \
			$_amavis_home/var \
			$_amavis_home/db \
			$_amavis_home/home \
			$_amavis_home/quarantine \
			; do
		install -dm750 -o amavis -g amavis "${pkgdir}$dir"
	done

	for file in amavisd amavisd-nanny amavisd-release; do
		install -Dm755 -o root -g amavis "$file" "$pkgdir/usr/sbin/$file"
	done

	install -Dm640 -o root -g amavis amavisd.conf "$pkgdir"/etc/amavisd.conf
	install -Dm755 "$srcdir"/amavisd.initd "$pkgdir"/etc/init.d/amavisd
	install -Dm644 "$srcdir"/amavisd.confd "$pkgdir"/etc/conf.d/amavisd
}

sha512sums="
7ef5ba670b530bf19352ba8aebd57a171e32d90adffc0b248b93a39f740fe4bb8ddf1d5ecdd46d0c9e1b4ca1a9ff0a9e86e73900e73a1a2cac514656c3a7db01  amavis-v2.12.2.tar.gz
6a9dd16a6b52f3d1fbd16887f29ccceddc58e88a02e681f23c1fe54b7e24feea5089d52813f4f3e87d9242daf79d2b2ea1e7c451d83d7de943403e71dc61c4e5  amavisd.initd
a5ce3583c34197f335372728cf92da23bae2cd7a9ae48daff6eaadbf66fbd5be6bb8b480b0fce1ea2b3a662b0a54d1d2f1f277d2f9a06d9630b57fa5d7ac2635  amavisd.confd
87f9c4489fb377e6e1315edcef75940b1a61a30c418106c1ef48eef4f425746333c550b270e0e6727fe89a68239f673f24392d81a53157ad487d3d2da1e95b4c  amavisd-conf.patch
"
